iT邦幫忙

第 12 屆 iThome 鐵人賽

DAY 9
0
DevOps

30 Days of MLOps系列 第 9

透過 REST API 與 Model 互動 - 30 Days of MLOps

  • 分享至 

  • xImage
  •  

取得 Model 的狀態資訊 API

語法

GET http://host:port/v1/models/${MODEL_NAME}[/versions/${VERSION}|/labels/${LABEL}]

API 呼叫範例

curl http://localhost:8501/v1/models/saved_model_half_plus_three

API Response 範例

{
  "model_version_status": [
    {
      "version": "123",
      "state": "AVAILABLE",
      "status": {
        "error_code": "OK",
        "error_message": ""
      }
    }
  ]
}

取得 Model Metadata 資訊 API

語法

GET http://host:port/v1/models/${MODEL_NAME}[/versions/${VERSION}|/labels/${LABEL}]/metadata

API 呼叫範例

curl http://localhost:8501/v1/models/saved_model_half_plus_three/metadata

API Response 範例

{
"model_spec":{
 "name": "saved_model_counter",
 "signature_name": "",
 "version": "123"
}
,
"metadata": {"signature_def": {
 "signature_def": {
  "incr_counter_by": {
   "inputs": {
    "delta": {
     "dtype": "DT_FLOAT",
     "tensor_shape": {
      "dim": [],
      "unknown_rank": true
     },
     "name": "delta:0"
    }
   },
   "outputs": {
    "output": {
     "dtype": "DT_FLOAT_REF",
     "tensor_shape": {
      "dim": [],
      "unknown_rank": false
     },
     "name": "incr_counter_by_op/AssignAdd:0"
    }
   },
   "method_name": "tensorflow/serving/predict"
  },
  "reset_counter": {
   "inputs": {},
   "outputs": {
    "output": {
     "dtype": "DT_FLOAT_REF",
     "tensor_shape": {
      "dim": [],
      "unknown_rank": false
     },
     "name": "reset_counter_op/Assign:0"
    }
   },
   "method_name": "tensorflow/serving/predict"
  },
  "incr_counter": {
   "inputs": {},
   "outputs": {
    "output": {
     "dtype": "DT_FLOAT_REF",
     "tensor_shape": {
      "dim": [],
      "unknown_rank": false
     },
     "name": "incr_counter_op/AssignAdd:0"
    }
   },
   "method_name": "tensorflow/serving/predict"
  },
  "get_counter": {
   "inputs": {},
   "outputs": {
    "output": {
     "dtype": "DT_FLOAT_REF",
     "tensor_shape": {
      "dim": [],
      "unknown_rank": false
     },
     "name": "counter:0"
    }
   },
   "method_name": "tensorflow/serving/predict"
  }
 }
}
}
}

參考資料


上一篇
Serving 多個 Model - 30 Days of MLOps
下一篇
呼叫 Classify 和 Regress API - 30 Days of MLOps
系列文
30 Days of MLOps23
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言